home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-01
/
get3270.zip
/
GET3270.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-01-04
|
3KB
|
117 lines
#include <stdio.h>
#include <dos.h>
#include <ctype.h>
int api_function;
int api_length;
int api_return;
char api_string[255];
main(argc,argv)
int argc;
char *argv[];
{
int i;
int j;
char pspace[2000];
int get_pspace(char *);
int display_pspace(char *);
/* reset hllapi */
api_function = 21;
HLLC(&api_function,api_string,&api_length,&api_return);
if ( api_return == 9 ) {
fprintf(stderr,"\nError - system cannot be reset.\n\n");
fprintf(stderr,"Probable cause - EEHLLAPI not loaded\n\n");
fprintf(stderr,"Press the space bar to continue.....");
getch();
return(api_return);
}
/* connect to host system */
api_function = 1;
strcpy(api_string,"E\0");
api_length = 1;
HLLC(&api_function,api_string,&api_length,&api_return);
if ( api_return != 0 ) {
fprintf(stderr,"\nError - could not connect to host session, rc= %4d\n\n",api_return);
fprintf(stderr,"Probable cause - EEHLLAPI not loaded\n\n");
fprintf(stderr,"Press the space bar to continue.....");
getch();
return(api_return);
}
/* We're talking to the mainframe session - get the presentation space
and write it to STDOUT.
*/
get_pspace(pspace);
display_pspace(pspace);
/* Disconnect presentation space before quitting */
api_function = 2;
HLLC(&api_function,api_string,&api_length,&api_return);
} /* main */
int get_pspace(p_space)
/* return the entire contents of the presentation space into a passed
string. The string must be preallocated to at least 1920. The
function returns the value of the return string */
char *p_space;
{
api_function = 8;
api_length = 1920;
api_return = 1;
HLLC(&api_function,p_space,&api_length,&api_return);
return(api_return);
}
display_pspace(p_space)
/* display the current contents of the presentation space
on the screen. Normal usage is:
get_pspace(pspace);
display_pspace(pspace);
getch();
The screen displayed on the PC should be identical to the
mainframe screen. */
char *p_space;
{
int j;
printf("\n");
for (j=0;j<1920;j++) printf("%c",p_space[j]);
printf("\n\n");
}